/**
 * 调用user相关http接口
 */
import httpUtil from './index.js'

// 注册用户
export function registerUser (params) {
  return httpUtil({
    url: "/users/register",
    method: "post",
    data: params
  })
}

// 登录
export function loginUser (params) {
  return httpUtil({
    url: "/users/loginIn",
    method: "post",
    data: params
  })
}

// 退出登录
export function logoutUser () {
  return httpUtil({
    url: "/users/loginOut",
    method: "get"
  })
}

// 修改用户积分
export function updateScore (data) {
  return httpUtil({
    url: "/user/updateScore",
    method: "patch",
    data
  })
}

// 获取积分
export function getScore (userId) {
  return httpUtil({
    url: "/users/getScore/" + userId,
    method: "get",
  })
}

export function getAllScore () {
  return httpUtil({
    url: "/users/getAllScore/",
    method: "get",
  })
}

// 获取所有的职位
export function getJobs () {
  return httpUtil({
    url: "/jobs/",
    method: "get",
  })
}

// 获取成就
export function getAchievements (userId) {
  return httpUtil({
    url: "/achievements?userId=" + userId,
    method: "get",
  })
}